package com.nettyrpc.bean;

import java.lang.reflect.Method;

public class JdkProxyHandlerAdapter extends AbstractInvokeHandler {

    @Override
    public Object doHandle(Class<?> clazz, Object serviceBean, String methodName, Class<?>[] parameterTypes, Object[] parameters) throws Throwable {
        // JDK reflect
        Method method = clazz.getMethod(methodName, parameterTypes);
        method.setAccessible(true);
        return method.invoke(serviceBean, parameters);
    }

}
